<?php

class UploadHelper {

	protected $path = "upload/";
	protected $file;
	protected $fileName;
	protected $fileTmpName;
	
	public function setPath($path) {
		$this->path = $path;
	}

	public function setFile($file) {
		$this->file = $file;
		$this->setFileName();
		$this->setFileTmpName();
	}

	protected function setFileName() {
		$this->fileName = $this->file['name'];
	}

	protected function setFileTmpName() {
		$this->fileTmpName = $this->file['tmp_name'];
	}

	public function upload() {
		if ( move_uploaded_file($this->fileTmpName, $_SERVER["DOCUMENT_ROOT"] . BASE . $this->path . $this->fileName))
			return true;
		return false;
	}
}

?>